#ifndef GAMEAPP_H
#define GAMEAPP_H


#include <d3d9.h>
#include <d3dx9.h>

#include "Timer.h"
#include "DirectInput.h"
#include "Skybox.h"
#include "CameraSystem.h"



#define SCREEN_WIDTH	800
#define SCREEN_HEIGHT	600
#define	FRAME_RATE		60

class CGameApp
{
public:

	///---------------------------------------------------------------------------------------
	// Constructor & Destructor for this class -----------------------------------------------
	///---------------------------------------------------------------------------------------
			 CGameApp(void);
	virtual ~CGameApp(void);

	//-----------------------------------------------------------------------------------------
	/// Public function------------------------------------------------------------------------
	//-----------------------------------------------------------------------------------------
	static LRESULT CALLBACK		StaticWinProc(HWND, UINT, WPARAM, LPARAM);
	BOOL						GameInit(HINSTANCE);
	void						GameRun();
	void						GameEnd();
	LPDIRECT3DDEVICE9			GetDevice();

private:

	//-----------------------------------------------------------------------------------------
	/// Private Variables ---------------------------------------------------------------------
	//-----------------------------------------------------------------------------------------

	HWND						m_hWnd;

	Timer						m_Timer;

	BOOL						m_bLostDevice;
	BOOL						m_bActiveRender;
	BOOL						m_bActiveKey;

	USHORT						m_usLastFrameRate;
	USHORT						m_usFrameRate;

	D3DXMATRIX					m_mtxView;
	D3DXMATRIX					m_mtxProjection;

	LPDIRECT3D9					m_pD3D;
	LPDIRECT3DDEVICE9			m_pD3DDevice;
	D3DPRESENT_PARAMETERS		m_D3DPresentParam;

	//-----------------------------------------------------------------------------------------
	/// Private Function ----------------------------------------------------------------------
	//-----------------------------------------------------------------------------------------

	BOOL						InitWindow(HINSTANCE);
	BOOL						InitDirect3D();

	void						FrameAdvance();
	void						Render();
	void						UpdateGame();
	LRESULT CALLBACK			WinProc(HWND, UINT, WPARAM, LPARAM);
};	


#endif